// Set a planet as home to send fleets quickly to there.

$().ready(function() {

var ap_home_html, id, ap_home;

id = $.trim($('#awplus_content table tr:eq(0) td').text());
ap_home = $.cookie('ap_home');

if (id != ap_home) {
  ap_home_html = ' <small><a href="javascript: void(0)" id="ap_sethome">[set as home]</a></small>';
}
else {
  ap_home_html = ' <small>[home]</small>';
}

$('#awplus_content table tr:eq(0) td').append(ap_home_html);

$('#ap_sethome').click(function() {
  if (!confirm('Do you really want set "'+id+'" as home?')) return;
  $.cookie('ap_home', id, {expires: 365, path: '/'});
  $(this).text('[home]');
});

});
